﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using Model;

namespace BLL
{
    public class RolesBLL
    {
        RolesDAL dal = new RolesDAL();

        /// <summary>
        /// 显示角色
        /// </summary>
        /// <returns></returns>
        public List<Roles> ShowRoles()
        {
            return dal.Show();
        }

        public List<Roles> PaperRoles(int PageIndex, int PageSize, out int PageCount)
        {
            PageCount = dal.Show().Count();
            return dal.Show().Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList();
        }
        /// <summary>
        /// 添加角色
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool AddRoles(Roles m)
        {
            return dal.Add(m);
        }

        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        public bool DelRoles(Roles m)
        {
            return dal.Del(m);
        }

        /// <summary>
        /// 查询单个角色信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Roles BackRoles(int id)
        {
            return dal.Back(id);
        }

        /// <summary>
        /// 修改角色信息
        /// </summary>
        /// <param name="m"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool UpdRoles(Roles m, int id)
        {
            return dal.Update(m, id);
        }
    }
}
